deletion of a folder

How to purge a unwanted folder using dxl? Any help?
ashokanumula - Fri Oct 28 17:28:08 EDT 2011

Re: deletion of a folder
llandale - Sat Oct 29 15:14:30 EDT 2011

There are commands that return error messages on error:
string purge(Item)
string purge(Folder)

so turn the name of the folder into either an Item of Folder handle:
purge(item(NameFolder))
purge(folder(NameFolder))

Nothing can be open in the folder, so you cannot purge the current folder since YOU have it open. I recall that Objects would not purge unless they were first UNdeleted, perhaps that applies to folders.

Folder fld = folder(NameFolderToDelete)
if (isDeleted(fld)) undelete(fld) // ?? May not be needed??
string ErrMess = purge(fld)

The hard part of such a program is specifying with absolute confidence which folders are "unwanted". Its probably easier to do such purging manually, and hopefully mindfully. I'd be tempted to first convert the folder to a project, archive it, then purge the temp project.

  • Louie

Re: deletion of a folder
ashokanumula - Mon Oct 31 12:16:21 EDT 2011

Thank you Louie.

Re: deletion of a folder
SystemAdmin - Thu Aug 30 10:54:06 EDT 2012

llandale - Sat Oct 29 15:14:30 EDT 2011
There are commands that return error messages on error:
string purge(Item)
string purge(Folder)

so turn the name of the folder into either an Item of Folder handle:
purge(item(NameFolder))
purge(folder(NameFolder))

Nothing can be open in the folder, so you cannot purge the current folder since YOU have it open. I recall that Objects would not purge unless they were first UNdeleted, perhaps that applies to folders.

Folder fld = folder(NameFolderToDelete)
if (isDeleted(fld)) undelete(fld) // ?? May not be needed??
string ErrMess = purge(fld)

The hard part of such a program is specifying with absolute confidence which folders are "unwanted". Its probably easier to do such purging manually, and hopefully mindfully. I'd be tempted to first convert the folder to a project, archive it, then purge the temp project.

  • Louie

Hello,
Is my logic correct for deleting a Folder?

-Jim
 

Item fol = item "/CNPE - Project/sample"
delete (fol)
string ErrMess = purge(fol)
if(!null ErrMess){errorBox(ErrMess)}

Re: deletion of a folder
Mathias Mamsch - Thu Aug 30 11:15:47 EDT 2012

SystemAdmin - Thu Aug 30 10:54:06 EDT 2012

Hello,
Is my logic correct for deleting a Folder?

-Jim
 

Item fol = item "/CNPE - Project/sample"
delete (fol)
string ErrMess = purge(fol)
if(!null ErrMess){errorBox(ErrMess)}

Changing the current folder is not enough to 'close' the folder. You need to set the DOORS database Explorer to a new directory (best "/") before you delete the folder. Maybe this helps, regards, Mathias
 

string wipeFolder (string s) {
        openPath "/"  // go to the root folder in the database 
                      // you might want to do something more elaborate her
        current = folder "/"
 
        Folder f = folder s 
        if (!null f) {
            noError()
            if (!isDeleted f) delete f
            string errMsg1 = purge f
            string errMsg2 = lastError()
            return errMsg1 errMsg2
        }
        return ""
    }

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Re: deletion of a folder
SystemAdmin - Thu Aug 30 12:20:32 EDT 2012

Mathias Mamsch - Thu Aug 30 11:15:47 EDT 2012

Changing the current folder is not enough to 'close' the folder. You need to set the DOORS database Explorer to a new directory (best "/") before you delete the folder. Maybe this helps, regards, Mathias
 

string wipeFolder (string s) {
        openPath "/"  // go to the root folder in the database 
                      // you might want to do something more elaborate her
        current = folder "/"
 
        Folder f = folder s 
        if (!null f) {
            noError()
            if (!isDeleted f) delete f
            string errMsg1 = purge f
            string errMsg2 = lastError()
            return errMsg1 errMsg2
        }
        return ""
    }

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

 

Hello,

when using your code via batch script I'm getting the following error any ideas?
 

-E- DXL: <E:\DOORS BK Script\rename_root2.dxl:4> incorrectly concatenated tokens
 
-E- DXL: <E:\DOORS BK Script\rename_root2.dxl:4> undeclared variable (openPath)
-I- DXL: All done. Errors reported: 2. Warnings reported: 0.
 
Press return to exit DOORS.

Re: deletion of a folder
Mathias Mamsch - Thu Aug 30 15:48:51 EDT 2012

SystemAdmin - Thu Aug 30 12:20:32 EDT 2012

Hello,

when using your code via batch script I'm getting the following error any ideas?
 

-E- DXL: <E:\DOORS BK Script\rename_root2.dxl:4> incorrectly concatenated tokens
 
-E- DXL: <E:\DOORS BK Script\rename_root2.dxl:4> undeclared variable (openPath)
-I- DXL: All done. Errors reported: 2. Warnings reported: 0.
 
Press return to exit DOORS.

Ok, in case of a batch script you do not need to worry about the database explorer :-), so you can remove the openPath statement. Regards, Mathias


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

Re: deletion of a folder
llandale - Tue Sep 04 17:25:12 EDT 2012

SystemAdmin - Thu Aug 30 10:54:06 EDT 2012

Hello,
Is my logic correct for deleting a Folder?

-Jim
 

Item fol = item "/CNPE - Project/sample"
delete (fol)
string ErrMess = purge(fol)
if(!null ErrMess){errorBox(ErrMess)}

If your "purge" doesn't work, then perhaps it is like the Object purger "hardDelete(obj)" which requires the object to by UNDELETED. If so, you must not delete the folder first.

Yes, I'm sure you will need to be sure you are not "in" the target folder; for me that is:
  • Folder fTop = folder("/")
  • current = fTop

-Louie